from fastapi.encoders import jsonable_encoder

from models import Base


def model_serialize_json(model: Base, data: list):
    return jsonable_encoder(list(map(lambda x: model.from_orm(x), data)))
